/**
 * @desc
 *
 * @使用场景
 *
 * @author  杨晓东[of1081]
 * @company qianmi.com
 * @Date    15/10/12
 **/
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
class fileUtil {
}
/**
 * 同步在做, 如果没有同步需要建议使用fse.walk()
 * 遍历目录树,
 * @param filePath 目录地址: /etc
 * @param callBack 如果是file文件非目录, 那么就调用此回调函数
 * @param dirCallBack 如果是目录, 那么就调用此回调函数 opt
 */
fileUtil.traceDirTree = function (filePath, callBack, dirCallBack) {
    //window下就
    filePath = filePath.replace(/\\/g, '/');
    var state = fs.lstatSync(filePath);
    if (state.isDirectory()) {
        dirCallBack && dirCallBack(filePath);
        var fileLists = fs.readdirSync(filePath);
        fileLists.forEach(function (subFilePath) {
            fileUtil.traceDirTree(path.join(filePath, subFilePath), callBack, dirCallBack);
        });
    }
    else if (state.isFile()) {
        callBack(filePath);
    }
    else {
    }
};
exports.default = fileUtil;
